package com.testapis.test.controller;

import com.testapis.test.dao.PersonDao;
import com.testapis.test.entity.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PersonController {
    @Autowired
    PersonDao personDao;

    @GetMapping("/savePerson")
    public boolean insertPerson(){
        Person person = new Person();
        person.setId(1);
        person.setName("wang");
        person.setPro("Teacher");
        return personDao.savePerson(person);
    }

    @GetMapping("/selectPerson")
    public String selectPerson(){
        Person person = personDao.findTestByName("wang");
        String result = person.toString();
        return result;
    }
}
